<template>
  <footer class="footer">
    <span class="todo-count"
      >剩余<strong>{{ sheng }}</strong></span
    >
    <ul class="filters">
      <li>
        <a
          :class="{ selected: type === 'all' }"
          @click="fn('all')"
          href="javascript:;"
          >全部</a
        >
      </li>
      <li>
        <a
          :class="{ selected: type === 'active' }"
          @click="fn('active')"
          href="javascript:;"
          >未完成</a
        >
      </li>
      <li>
        <a
          :class="{ selected: type === 'activeko' }"
          @click="fn('activeko')"
          href="javascript:;"
          >已完成</a
        >
      </li>
    </ul>
    <button class="clear-completed" @click="clears" v-show="clarShow">
      清除已完成
    </button>
  </footer>
</template>

<script>
import { mapActions, mapGetters, mapMutations, mapState } from "vuex";
export default {
  computed: {
    //剩余多少
    ...mapGetters("todos", ["sheng", "clarShow"]),
    ...mapState("todos", ["type"]),
  },
  methods: {
    ...mapMutations("todos", ["fn"]),
    ...mapActions("todos", ["clears"]),
  },
};
</script>
